package o;

import java.io.Closeable;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.Socket;
import java.net.SocketException;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import okhttp3.internal.http2.ConnectionShutdownException;

public final class fwk implements Closeable {
    private static final ExecutorService ʻॱ = new ThreadPoolExecutor(0, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, 60, TimeUnit.SECONDS, new SynchronousQueue(), fvg.ˊ("OkHttp Http2Connection", true));
    static final /* synthetic */ boolean ॱˎ;
    int ʻ;
    long ʼ;
    final fwo ʽ;
    private boolean ʽॱ;
    private final ExecutorService ˈ;
    int ˊ;
    boolean ˊॱ = false;
    final boolean ˋ;
    final Socket ˋॱ;
    final a ˎ;
    final String ˏ;
    final fwn ˏॱ;
    final fwl ͺ = new fwl();
    final Map<Integer, fwh> ॱ = new LinkedHashMap();
    fwl ॱˊ = new fwl();
    final Set<Integer> ॱˋ = new LinkedHashSet();
    boolean ॱॱ;
    final e ॱᐝ;
    long ᐝ = 0;
    private final ScheduledExecutorService ᐝॱ;

    public static abstract class a {
        public static final a REFUSE_INCOMING_STREAMS = new a() {
            public void onStream(fwh o_fwh) throws IOException {
                o_fwh.ˎ(fwf.REFUSED_STREAM);
            }
        };

        public abstract void onStream(fwh o_fwh) throws IOException;

        public void onSettings(fwk o_fwk) {
        }
    }

    public static class b {
        int ʻ;
        fwo ʽ = fwo.ॱ;
        String ˊ;
        Socket ˋ;
        a ˎ = a.REFUSE_INCOMING_STREAMS;
        fxj ˏ;
        fxg ॱ;
        boolean ॱॱ;

        public b(boolean z) {
            this.ॱॱ = z;
        }

        public b ˊ(Socket socket, String str, fxg o_fxg, fxj o_fxj) {
            this.ˋ = socket;
            this.ˊ = str;
            this.ॱ = o_fxg;
            this.ˏ = o_fxj;
            return this;
        }

        public b ˊ(a aVar) {
            this.ˎ = aVar;
            return this;
        }

        public b ॱ(int i) {
            this.ʻ = i;
            return this;
        }

        public fwk ॱ() {
            return new fwk(this);
        }
    }

    final class d extends fva {
        final boolean ˊ;
        final int ˋ;
        final int ˎ;
        final /* synthetic */ fwk ˏ;

        d(fwk o_fwk, boolean z, int i, int i2) {
            this.ˏ = o_fwk;
            super("OkHttp %s ping %08x%08x", o_fwk.ˏ, Integer.valueOf(i), Integer.valueOf(i2));
            this.ˊ = z;
            this.ˋ = i;
            this.ˎ = i2;
        }

        public void ॱॱ() {
            this.ˏ.ˊ(this.ˊ, this.ˋ, this.ˎ);
        }
    }

    class e extends fva implements c {
        final fwg ˊ;
        final /* synthetic */ fwk ˏ;

        e(fwk o_fwk, fwg o_fwg) {
            this.ˏ = o_fwk;
            super("OkHttp %s", o_fwk.ˏ);
            this.ˊ = o_fwg;
        }

        protected void ॱॱ() {
            fwf o_fwf;
            Throwable th;
            fwf o_fwf2 = fwf.INTERNAL_ERROR;
            fwf o_fwf3 = fwf.INTERNAL_ERROR;
            try {
                this.ˊ.ˊ(this);
                do {
                } while (this.ˊ.ˊ(false, this));
                try {
                    this.ˏ.ˎ(fwf.NO_ERROR, fwf.CANCEL);
                } catch (IOException e) {
                }
                fvg.ॱ(this.ˊ);
            } catch (IOException e2) {
                o_fwf = fwf.PROTOCOL_ERROR;
                try {
                    this.ˏ.ˎ(o_fwf, fwf.PROTOCOL_ERROR);
                } catch (IOException e3) {
                }
                fvg.ॱ(this.ˊ);
            } catch (Throwable th2) {
                th = th2;
                this.ˏ.ˎ(o_fwf, o_fwf3);
                fvg.ॱ(this.ˊ);
                throw th;
            }
        }

        public void ˊ(boolean z, int i, fxg o_fxg, int i2) throws IOException {
            if (this.ˏ.ˎ(i)) {
                this.ˏ.ॱ(i, o_fxg, i2, z);
                return;
            }
            fwh ˋ = this.ˏ.ˋ(i);
            if (ˋ == null) {
                this.ˏ.ˊ(i, fwf.PROTOCOL_ERROR);
                this.ˏ.ˋ((long) i2);
                o_fxg.ʼ((long) i2);
                return;
            }
            ˋ.ॱ(o_fxg, i2);
            if (z) {
                ˋ.ʽ();
            }
        }

        /* JADX WARNING: inconsistent code. */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        public void ˏ(boolean r9, int r10, int r11, java.util.List<o.fwb> r12) {
            /*
            r8 = this;
            r0 = r8.ˏ;
            r0 = r0.ˎ(r10);
            if (r0 == 0) goto L_0x000e;
        L_0x0008:
            r0 = r8.ˏ;
            r0.ˊ(r10, r12, r9);
        L_0x000d:
            return;
        L_0x000e:
            r6 = r8.ˏ;
            monitor-enter(r6);
            r0 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r0 = r0.ˋ(r10);	 Catch:{ all -> 0x0021 }
            if (r0 != 0) goto L_0x0076;
        L_0x0019:
            r0 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r0 = r0.ॱॱ;	 Catch:{ all -> 0x0021 }
            if (r0 == 0) goto L_0x0024;
        L_0x001f:
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            goto L_0x000d;
        L_0x0021:
            r0 = move-exception;
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            throw r0;
        L_0x0024:
            r0 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r0 = r0.ˊ;	 Catch:{ all -> 0x0021 }
            if (r10 > r0) goto L_0x002c;
        L_0x002a:
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            goto L_0x000d;
        L_0x002c:
            r0 = r10 % 2;
            r1 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r1 = r1.ʻ;	 Catch:{ all -> 0x0021 }
            r1 = r1 % 2;
            if (r0 != r1) goto L_0x0038;
        L_0x0036:
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            goto L_0x000d;
        L_0x0038:
            r5 = o.fvg.ˊ(r12);	 Catch:{ all -> 0x0021 }
            r0 = new o.fwh;	 Catch:{ all -> 0x0021 }
            r2 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r3 = 0;
            r1 = r10;
            r4 = r9;
            r0.<init>(r1, r2, r3, r4, r5);	 Catch:{ all -> 0x0021 }
            r1 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r1.ˊ = r10;	 Catch:{ all -> 0x0021 }
            r1 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r1 = r1.ॱ;	 Catch:{ all -> 0x0021 }
            r2 = java.lang.Integer.valueOf(r10);	 Catch:{ all -> 0x0021 }
            r1.put(r2, r0);	 Catch:{ all -> 0x0021 }
            r1 = o.fwk.ʻॱ;	 Catch:{ all -> 0x0021 }
            r2 = new o.fwk$e$3;	 Catch:{ all -> 0x0021 }
            r3 = "OkHttp %s stream %d";
            r4 = 2;
            r4 = new java.lang.Object[r4];	 Catch:{ all -> 0x0021 }
            r5 = 0;
            r7 = r8.ˏ;	 Catch:{ all -> 0x0021 }
            r7 = r7.ˏ;	 Catch:{ all -> 0x0021 }
            r4[r5] = r7;	 Catch:{ all -> 0x0021 }
            r5 = 1;
            r7 = java.lang.Integer.valueOf(r10);	 Catch:{ all -> 0x0021 }
            r4[r5] = r7;	 Catch:{ all -> 0x0021 }
            r2.<init>(r8, r3, r4, r0);	 Catch:{ all -> 0x0021 }
            r1.execute(r2);	 Catch:{ all -> 0x0021 }
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            goto L_0x000d;
        L_0x0076:
            monitor-exit(r6);	 Catch:{ all -> 0x0021 }
            r0.ˏ(r12);
            if (r9 == 0) goto L_0x000d;
        L_0x007c:
            r0.ʽ();
            goto L_0x000d;
            */
            throw new UnsupportedOperationException("Method not decompiled: o.fwk.e.ˏ(boolean, int, int, java.util.List):void");
        }

        public void ॱ(int i, fwf o_fwf) {
            if (this.ˏ.ˎ(i)) {
                this.ˏ.ˋ(i, o_fwf);
                return;
            }
            fwh ˊ = this.ˏ.ˊ(i);
            if (ˊ != null) {
                ˊ.ˋ(o_fwf);
            }
        }

        public void ॱ(boolean z, fwl o_fwl) {
            fwh[] o_fwhArr;
            long j;
            synchronized (this.ˏ) {
                int ॱ = this.ˏ.ͺ.ॱ();
                if (z) {
                    this.ˏ.ͺ.ˊ();
                }
                this.ˏ.ͺ.ˋ(o_fwl);
                ˎ(o_fwl);
                int ॱ2 = this.ˏ.ͺ.ॱ();
                if (ॱ2 == -1 || ॱ2 == ॱ) {
                    o_fwhArr = null;
                    j = 0;
                } else {
                    long j2 = (long) (ॱ2 - ॱ);
                    if (!this.ˏ.ˊॱ) {
                        this.ˏ.ˊॱ = true;
                    }
                    if (this.ˏ.ॱ.isEmpty()) {
                        j = j2;
                        o_fwhArr = null;
                    } else {
                        j = j2;
                        o_fwhArr = (fwh[]) this.ˏ.ॱ.values().toArray(new fwh[this.ˏ.ॱ.size()]);
                    }
                }
                fwk.ʻॱ.execute(new fva(this, "OkHttp %s settings", this.ˏ.ˏ) {
                    final /* synthetic */ e ˊ;

                    public void ॱॱ() {
                        this.ˊ.ˏ.ˎ.onSettings(this.ˊ.ˏ);
                    }
                });
            }
            if (o_fwhArr != null && j != 0) {
                for (fwh o_fwh : o_fwhArr) {
                    synchronized (o_fwh) {
                        o_fwh.ˎ(j);
                    }
                }
            }
        }

        private void ˎ(final fwl o_fwl) {
            try {
                this.ˏ.ᐝॱ.execute(new fva(this, "OkHttp %s ACK Settings", new Object[]{this.ˏ.ˏ}) {
                    final /* synthetic */ e ˊ;

                    public void ॱॱ() {
                        try {
                            this.ˊ.ˏ.ˏॱ.ˏ(o_fwl);
                        } catch (IOException e) {
                            this.ˊ.ˏ.ʼ();
                        }
                    }
                });
            } catch (RejectedExecutionException e) {
            }
        }

        public void ˏ() {
        }

        public void ˊ(boolean z, int i, int i2) {
            if (z) {
                synchronized (this.ˏ) {
                    this.ˏ.ʽॱ = false;
                    this.ˏ.notifyAll();
                }
                return;
            }
            try {
                this.ˏ.ᐝॱ.execute(new d(this.ˏ, true, i, i2));
            } catch (RejectedExecutionException e) {
            }
        }

        public void ˊ(int i, fwf o_fwf, fxh o_fxh) {
            if (o_fxh.ʼ() > 0) {
            }
            synchronized (this.ˏ) {
                fwh[] o_fwhArr = (fwh[]) this.ˏ.ॱ.values().toArray(new fwh[this.ˏ.ॱ.size()]);
                this.ˏ.ॱॱ = true;
            }
            for (fwh o_fwh : o_fwhArr) {
                if (o_fwh.ˏ() > i && o_fwh.ˊ()) {
                    o_fwh.ˋ(fwf.REFUSED_STREAM);
                    this.ˏ.ˊ(o_fwh.ˏ());
                }
            }
        }

        public void ॱ(int i, long j) {
            if (i == 0) {
                synchronized (this.ˏ) {
                    fwk o_fwk = this.ˏ;
                    o_fwk.ʼ += j;
                    this.ˏ.notifyAll();
                }
                return;
            }
            fwh ˋ = this.ˏ.ˋ(i);
            if (ˋ != null) {
                synchronized (ˋ) {
                    ˋ.ˎ(j);
                }
            }
        }

        public void ॱ(int i, int i2, int i3, boolean z) {
        }

        public void ॱ(int i, int i2, List<fwb> list) {
            this.ˏ.ˊ(i2, (List) list);
        }
    }

    static {
        boolean z;
        if (fwk.class.desiredAssertionStatus()) {
            z = false;
        } else {
            z = true;
        }
        ॱˎ = z;
    }

    fwk(b bVar) {
        this.ʽ = bVar.ʽ;
        this.ˋ = bVar.ॱॱ;
        this.ˎ = bVar.ˎ;
        this.ʻ = bVar.ॱॱ ? 1 : 2;
        if (bVar.ॱॱ) {
            this.ʻ += 2;
        }
        if (bVar.ॱॱ) {
            this.ॱˊ.ˊ(7, 16777216);
        }
        this.ˏ = bVar.ˊ;
        this.ᐝॱ = new ScheduledThreadPoolExecutor(1, fvg.ˊ(fvg.ˊ("OkHttp %s Writer", this.ˏ), false));
        if (bVar.ʻ != 0) {
            this.ᐝॱ.scheduleAtFixedRate(new d(this, false, 0, 0), (long) bVar.ʻ, (long) bVar.ʻ, TimeUnit.MILLISECONDS);
        }
        this.ˈ = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), fvg.ˊ(fvg.ˊ("OkHttp %s Push Observer", this.ˏ), true));
        this.ͺ.ˊ(7, 65535);
        this.ͺ.ˊ(5, 16384);
        this.ʼ = (long) this.ͺ.ॱ();
        this.ˋॱ = bVar.ˋ;
        this.ˏॱ = new fwn(bVar.ˏ, this.ˋ);
        this.ॱᐝ = new e(this, new fwg(bVar.ॱ, this.ˋ));
        try {
            this.ˋॱ.setTcpNoDelay(true);
        } catch (SocketException e) {
        }
    }

    synchronized fwh ˋ(int i) {
        return (fwh) this.ॱ.get(Integer.valueOf(i));
    }

    synchronized fwh ˊ(int i) {
        fwh o_fwh;
        o_fwh = (fwh) this.ॱ.remove(Integer.valueOf(i));
        notifyAll();
        return o_fwh;
    }

    public synchronized int ˎ() {
        return this.ͺ.ॱ(ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED);
    }

    synchronized void ˋ(long j) {
        this.ᐝ += j;
        if (this.ᐝ >= ((long) (this.ॱˊ.ॱ() / 2))) {
            ॱ(0, this.ᐝ);
            this.ᐝ = 0;
        }
    }

    public fwh ˎ(List<fwb> list, boolean z) throws IOException {
        return ॱ(0, list, z);
    }

    private fwh ॱ(int i, List<fwb> list, boolean z) throws IOException {
        fwh o_fwh;
        Object obj = null;
        boolean z2 = !z;
        synchronized (this.ˏॱ) {
            synchronized (this) {
                if (this.ʻ > 1073741823) {
                    ˎ(fwf.REFUSED_STREAM);
                }
                if (this.ॱॱ) {
                    throw new ConnectionShutdownException();
                }
                int i2 = this.ʻ;
                this.ʻ += 2;
                o_fwh = new fwh(i2, this, z2, false, null);
                if (!z || this.ʼ == 0 || o_fwh.ˊ == 0) {
                    obj = 1;
                }
                if (o_fwh.ॱ()) {
                    this.ॱ.put(Integer.valueOf(i2), o_fwh);
                }
            }
            if (i == 0) {
                try {
                    this.ˏॱ.ˊ(z2, i2, i, list);
                } catch (IOException e) {
                    ˊ(o_fwh.ˏ());
                    throw e;
                }
            } else if (this.ˋ) {
                throw new IllegalArgumentException("client streams shouldn't have associated stream IDs");
            } else {
                this.ˏॱ.ˊ(i, i2, (List) list);
            }
        }
        if (obj != null) {
            this.ˏॱ.ˎ();
        }
        return o_fwh;
    }

    public void ˊ(int i, boolean z, fxi o_fxi, long j) throws IOException {
        if (j == 0) {
            this.ˏॱ.ॱ(z, i, o_fxi, 0);
            return;
        }
        while (j > 0) {
            int min;
            boolean z2;
            int ˏ = this.ˏॱ.ˏ();
            synchronized (this) {
                while (this.ʼ <= 0) {
                    if (this.ॱ.containsKey(Integer.valueOf(i))) {
                        try {
                            wait();
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                            throw new InterruptedIOException();
                        }
                    }
                    throw new IOException("stream closed");
                }
                min = Math.min((int) Math.min(j, this.ʼ), ˏ);
                this.ʼ -= (long) min;
            }
            j -= (long) min;
            fwn o_fwn = this.ˏॱ;
            if (z && j == 0) {
                z2 = true;
            } else {
                z2 = false;
            }
            o_fwn.ॱ(z2, i, o_fxi, min);
        }
    }

    void ˊ(int i, fwf o_fwf) {
        try {
            final int i2 = i;
            final fwf o_fwf2 = o_fwf;
            this.ᐝॱ.execute(new fva(this, "OkHttp %s stream %d", new Object[]{this.ˏ, Integer.valueOf(i)}) {
                final /* synthetic */ fwk ˊ;

                public void ॱॱ() {
                    try {
                        this.ˊ.ˎ(i2, o_fwf2);
                    } catch (IOException e) {
                        this.ˊ.ʼ();
                    }
                }
            });
        } catch (RejectedExecutionException e) {
        }
    }

    void ˎ(int i, fwf o_fwf) throws IOException {
        this.ˏॱ.ॱ(i, o_fwf);
    }

    void ॱ(int i, long j) {
        try {
            final int i2 = i;
            final long j2 = j;
            this.ᐝॱ.execute(new fva(this, "OkHttp Window Update %s stream %d", new Object[]{this.ˏ, Integer.valueOf(i)}) {
                final /* synthetic */ fwk ˏ;

                public void ॱॱ() {
                    try {
                        this.ˏ.ˏॱ.ॱ(i2, j2);
                    } catch (IOException e) {
                        this.ˏ.ʼ();
                    }
                }
            });
        } catch (RejectedExecutionException e) {
        }
    }

    void ˊ(boolean z, int i, int i2) {
        if (!z) {
            boolean z2;
            synchronized (this) {
                z2 = this.ʽॱ;
                this.ʽॱ = true;
            }
            if (z2) {
                ʼ();
                return;
            }
        }
        try {
            this.ˏॱ.ˋ(z, i, i2);
        } catch (IOException e) {
            ʼ();
        }
    }

    public void ˋ() throws IOException {
        this.ˏॱ.ˎ();
    }

    public void ˎ(fwf o_fwf) throws IOException {
        synchronized (this.ˏॱ) {
            synchronized (this) {
                if (this.ॱॱ) {
                    return;
                }
                this.ॱॱ = true;
                int i = this.ˊ;
                this.ˏॱ.ˊ(i, o_fwf, fvg.ˊ);
            }
        }
    }

    public void close() throws IOException {
        ˎ(fwf.NO_ERROR, fwf.CANCEL);
    }

    void ˎ(fwf o_fwf, fwf o_fwf2) throws IOException {
        IOException iOException;
        if (ॱˎ || !Thread.holdsLock(this)) {
            fwh[] o_fwhArr;
            IOException iOException2;
            try {
                ˎ(o_fwf);
                iOException = null;
            } catch (IOException e) {
                iOException = e;
            }
            synchronized (this) {
                if (this.ॱ.isEmpty()) {
                    o_fwhArr = null;
                } else {
                    fwh[] o_fwhArr2 = (fwh[]) this.ॱ.values().toArray(new fwh[this.ॱ.size()]);
                    this.ॱ.clear();
                    o_fwhArr = o_fwhArr2;
                }
            }
            if (o_fwhArr != null) {
                iOException2 = iOException;
                for (fwh ˎ : o_fwhArr) {
                    try {
                        ˎ.ˎ(o_fwf2);
                    } catch (IOException iOException3) {
                        if (iOException2 != null) {
                            iOException2 = iOException3;
                        }
                    }
                }
                iOException3 = iOException2;
            }
            try {
                this.ˏॱ.close();
                iOException2 = iOException3;
            } catch (IOException e2) {
                iOException2 = e2;
                if (iOException3 != null) {
                    iOException2 = iOException3;
                }
            }
            try {
                this.ˋॱ.close();
            } catch (IOException e3) {
                iOException2 = e3;
            }
            this.ᐝॱ.shutdown();
            this.ˈ.shutdown();
            if (iOException2 != null) {
                throw iOException2;
            }
            return;
        }
        throw new AssertionError();
    }

    private void ʼ() {
        try {
            ˎ(fwf.PROTOCOL_ERROR, fwf.PROTOCOL_ERROR);
        } catch (IOException e) {
        }
    }

    public void ˊ() throws IOException {
        ˏ(true);
    }

    void ˏ(boolean z) throws IOException {
        if (z) {
            this.ˏॱ.ˊ();
            this.ˏॱ.ˊ(this.ॱˊ);
            int ॱ = this.ॱˊ.ॱ();
            if (ॱ != 65535) {
                this.ˏॱ.ॱ(0, (long) (ॱ - 65535));
            }
        }
        new Thread(this.ॱᐝ).start();
    }

    public synchronized boolean ˏ() {
        return this.ॱॱ;
    }

    boolean ˎ(int i) {
        return i != 0 && (i & 1) == 0;
    }

    void ˊ(int i, List<fwb> list) {
        synchronized (this) {
            if (this.ॱˋ.contains(Integer.valueOf(i))) {
                ˊ(i, fwf.PROTOCOL_ERROR);
                return;
            }
            this.ॱˋ.add(Integer.valueOf(i));
            try {
                final int i2 = i;
                final List<fwb> list2 = list;
                ˊ(new fva(this, "OkHttp %s Push Request[%s]", new Object[]{this.ˏ, Integer.valueOf(i)}) {
                    final /* synthetic */ fwk ˎ;

                    public void ॱॱ() {
                        if (this.ˎ.ʽ.ˏ(i2, list2)) {
                            try {
                                this.ˎ.ˏॱ.ॱ(i2, fwf.CANCEL);
                                synchronized (this.ˎ) {
                                    this.ˎ.ॱˋ.remove(Integer.valueOf(i2));
                                }
                            } catch (IOException e) {
                            }
                        }
                    }
                });
            } catch (RejectedExecutionException e) {
            }
        }
    }

    void ˊ(int i, List<fwb> list, boolean z) {
        try {
            final int i2 = i;
            final List<fwb> list2 = list;
            final boolean z2 = z;
            ˊ(new fva(this, "OkHttp %s Push Headers[%s]", new Object[]{this.ˏ, Integer.valueOf(i)}) {
                final /* synthetic */ fwk ˏ;

                public void ॱॱ() {
                    boolean ॱ = this.ˏ.ʽ.ॱ(i2, list2, z2);
                    if (ॱ) {
                        try {
                            this.ˏ.ˏॱ.ॱ(i2, fwf.CANCEL);
                        } catch (IOException e) {
                            return;
                        }
                    }
                    if (ॱ || z2) {
                        synchronized (this.ˏ) {
                            this.ˏ.ॱˋ.remove(Integer.valueOf(i2));
                        }
                    }
                }
            });
        } catch (RejectedExecutionException e) {
        }
    }

    void ॱ(int i, fxg o_fxg, int i2, boolean z) throws IOException {
        final fxi o_fxi = new fxi();
        o_fxg.ˎ((long) i2);
        o_fxg.ˊ(o_fxi, (long) i2);
        if (o_fxi.ॱ() != ((long) i2)) {
            throw new IOException(o_fxi.ॱ() + " != " + i2);
        }
        final int i3 = i;
        final int i4 = i2;
        final boolean z2 = z;
        ˊ(new fva(this, "OkHttp %s Push Data[%s]", new Object[]{this.ˏ, Integer.valueOf(i)}) {
            final /* synthetic */ fwk ʻ;

            public void ॱॱ() {
                try {
                    boolean ˊ = this.ʻ.ʽ.ˊ(i3, o_fxi, i4, z2);
                    if (ˊ) {
                        this.ʻ.ˏॱ.ॱ(i3, fwf.CANCEL);
                    }
                    if (ˊ || z2) {
                        synchronized (this.ʻ) {
                            this.ʻ.ॱˋ.remove(Integer.valueOf(i3));
                        }
                    }
                } catch (IOException e) {
                }
            }
        });
    }

    void ˋ(int i, fwf o_fwf) {
        final int i2 = i;
        final fwf o_fwf2 = o_fwf;
        ˊ(new fva(this, "OkHttp %s Push Reset[%s]", new Object[]{this.ˏ, Integer.valueOf(i)}) {
            final /* synthetic */ fwk ˏ;

            public void ॱॱ() {
                this.ˏ.ʽ.ˋ(i2, o_fwf2);
                synchronized (this.ˏ) {
                    this.ˏ.ॱˋ.remove(Integer.valueOf(i2));
                }
            }
        });
    }

    private synchronized void ˊ(fva o_fva) {
        if (!ˏ()) {
            this.ˈ.execute(o_fva);
        }
    }
}
